import shop from "../../api/shop";
//import shop from '@/api/shop'  @==>src

// 保存商品列表数据
const state = {
  list: []
};

//计算
const getters = {};

// 获取商品列表数据  异步 
const actions = {
  getList({ commit }) {
    shop.getGoodsList(
      data => {
      commit("setList", data);
    });
  }
};

// 将商品列表保存到state中
const mutations = {
  setList(state, data) {
    state.list = data;
  }
};
export default {
  namespaced: true,
  state,
  getters,
  actions,
  mutations
};
